<script setup lang="ts">
import { astar, Graph } from "javascript-astar";
const arr = [
  [1, 1, 1, 1],
  [0, 1, 1, 0],
  [0, 0, 1, 1],
];

var graphDiagonal = new Graph(arr, { diagonal: true });
console.log(JSON.stringify(graphDiagonal.grid));
var start = graphDiagonal.grid[0][0];
var end = graphDiagonal.grid[0][2];
var result = astar.search(graphDiagonal, start, end);
console.log(JSON.stringify(graphDiagonal.grid));

var start = graphDiagonal.grid[0][2];
var end = graphDiagonal.grid[0][0];
var result = astar.search(graphDiagonal, start, end);
console.log(result);
</script>

<template>
  <div>
    <div v-for="(item, index) in graphDiagonal.grid" :key="index">
      <span v-for="i in item">
        {{ i.weight }}
      </span>
    </div>
  </div>
</template>

<style lang=""></style>
